home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
TSPA3450
/
TSUNTJ.INT
< prev
next >
Wrap
Text File
|
1994-08-16
|
5KB
|
127 lines
(*
Timo Salmi UNiT J
A Turbo Pascal unit of file information and handling etc
All rights reserved 24-Nov-91, 6-Dec-92, 19-Aug-92, 7-Nov-92, 30-Jun-93
16-Aug-93, 28-Nov-93
In the 24-Nov-91 update of USUNTH unit part of its routines were
transferred here to TSUTNTJ. The transferred routines were
COPYFILE Copy a file from within a Turbo Pascal program
ISDIRFN Is a name a directory or not
OPENEDFN Is an assigned textfile still open or not
PIPEDIFN Is the standard input from redirection
PIPEDNFN Is the standard output redirected to nul
PIPEDOFN Is the standard output redirected
This unit may be used and distributed freely for PRIVATE, NON-COMMERCIAL,
NON-INSTITUTIONAL purposes, provided it is not changed in any way, and
that a proper attribution is made. For ANY other usage, such as use in a
business enterprise or at a university, contact the author for the terms
of registration.
The units are under development. Comments and contacts are solicited. If
you have any questions, please do not hesitate to use electronic mail for
communication.
InterNet address: ts@uwasa.fi
The author shall not be liable to the user for any direct, indirect or
consequential loss arising from the use of, or inability to use, any unit,
program or file howsoever caused. No warranty is given that the units and
programs will work under all circumstances.
Timo Salmi
Professor of Accounting and Business Finance
Faculty of Accounting & Industrial Management; University of Vaasa
P.O. BOX 297, FIN-65101 Vaasa, Finland
*)
unit TSUNTJ;
(* ======================================================================= *)
interface
(* ======================================================================= *)
uses Dos
{$IFDEF VER40}
,TSUNT45
{$ENDIF}
;
(* ====================================================================
File status information
==================================================================== *)
(* This function returns whether a name is a directory or not.
Avoid using this on an open file or standard devices.
PathStr is a predefined Turbo Pascal string type String[79].
See FAQPAS2.TXT in garbo.uwasa.fi:/pc/ts/tsfaqp*.zip for more
on the ISDIRFN functions *)
function ISDIRFN (name : PathStr) : boolean;
(* This function returns whether a name is a directory or not.
Avoid using this on an open file or standard devices.
An alternative method *)
function ISDIR2FN (name : string) : boolean;
(* Another alternative method for testing whether a name is a directory.
This is based on listing all the directories on the relevant drive,
and seeing whether the given name is found among them.
No leading or traling blanks or tabs are allowed in the name.
This is not very efficient, but it is robust, and instructive *)
function ISDIR3FN (name : string) : boolean;
(* This function returns whether a text file is open or closed.
^^^^
Naturally the FilePointer must have been assigned at an earlier stage.
Very convenient as a test in routines which close a file.
e.g. use: if OPENEDFN(f) then close(f); *)
function OPENEDFN (var FilePointer : text) : boolean;
(* This function returns whether a non-text file is open or closed. *)
function OPENFLFN (var FilePointer : file) : boolean;
(* Is the standard input from redirection. Based on PC-Mag Vol 10 No 7, 374,
Duncan 412, Dettmann 602-603 *)
function PIPEDIFN : boolean;
(* Is the standard output redirected. Based on PC-Mag Vol 10 No 7, 374,
Duncan 412, Dettmann 602-603 *)
function PIPEDOFN : boolean;
(* Is the standard output redirected to nul. Based on PC-Mag Vol 10 No 7, 374,
Duncan 412, Dettmann 602-603 *)
function PIPEDNFN : boolean;
(* ====================================================================
Program information
==================================================================== *)
(* Show the memory address where the interrupt is located *)
procedure INTRLOCA (IntrNumber : byte;
var segment : word;
var offset : word);
(* Show the memory address to which the interrupt points *)
procedure INTRADDR (IntrNumber : byte;
var segment : word;
var offset : word);
(* ====================================================================
Perform tasks
==================================================================== *)
(* Copy a file (of any type)
Status codes:
0 : ok
1 : FromFile does not exits
2 : ToFile already exists
3 : ToFile cannot be opened for writing (read-only,
write protected, invalid device)
4 : Error in writing to ToFile
5 : Copy error (disk probably full)
6 : Date stamp error
7 : Out of memory
*)
procedure COPYFILE (FromFile, ToFile : string; var status : byte);